//Component Object
const app = getApp();

import { CERTIFICATESTATUS } from "../../../../public/utils/const.js";
import api from "../../../../utils/apiInstance"

Component({
  properties: {
    data: {
      type: Object,
      value: {},
      observer: function (e) {
        if (e) {
          e.files.forEach(item => {
            if (item.fileNewName.indexOf("https://") < 0) {
              item.fileName = app.globalData.fileUrl + "" + item.fileNewName
            }
            else {
              item.fileName = item.originalFileName
            }

          });
          console.log('e',e)
          this.setData({
            dataItem: e,
            isGengHuanzj: e.type == "OutSide" && (CERTIFICATESTATUS[e.status].value == 3 ||CERTIFICATESTATUS[e.status].value == 6 || CERTIFICATESTATUS[e.status].value == 4),
            statusObj: CERTIFICATESTATUS[e.status]
          })
        }
      }
    },
    //是否是审核 
    status:{
      type:Boolean,
      value:false,
      observer: function (e) {
        this.setData({
          isShenHe:true
        })
      }
    }

  },
  data: {
    dataItem: {},
    typeColor: "",
    isGengHuanzj: false, //是否可以更换证件
    showReply:false,
    isShenHe:false
  },
  methods: {
    preImg(e) {
      console.log('e', e);

      const tempArray = [];

      e.currentTarget.dataset.files.forEach(item=>{
        tempArray.push(item.fileName)
      })
      wx.previewImage({
        current: e.currentTarget.dataset.url, // 当前显示图片的链接/路径
        urls: tempArray
      })
    },

    mergeReCall(){
      this.triggerEvent("mergeReCall",{id:this.data.dataItem.id});
    },

    doShowReply(){
      this.setData({
        showReply:!this.data.showReply
      })
    },

    doShenHe(){
      this.triggerEvent("doShenHe",{id:this.data.dataItem.id});
    },

    changeCerti() {
      let that = this;
      that.triggerEvent("changeCerti",{id:this.data.dataItem.id});
    },
  },
  lifetimes: {
    created: function () {

    },
    attached: function () {

    },
    ready: function () {
    },
    moved: function () {

    },
    detached: function () {

    }
  }

});